package us.wili.dev.client.model.rsp;

import com.alibaba.fastjson.annotation.JSONField;
import io.swagger.annotations.ApiModelProperty;
import us.wili.dev.client.model.Detail;
import us.wili.dev.common.model.IdLongToStrSerializer;
import us.wili.dev.model.entity.Goods;
import us.wili.dev.model.entity.Order;

import java.math.BigDecimal;

public class OrderRsp {
    @ApiModelProperty(value="id")
    @JSONField(serializeUsing = IdLongToStrSerializer.class)
    private Long Id;

    @ApiModelProperty(value="商品id")
    private Long goodsId;

    @ApiModelProperty(value="商品价格")
    private BigDecimal goodsPrice;

    @ApiModelProperty(value="商品名字")
    private String goodsName;

    @ApiModelProperty(value="商品主图")
    private String goodsPic;

    @ApiModelProperty(value="商品颜色")
    private Integer goodsColor;

    @ApiModelProperty(value="商品")
    private Goods goods;

    @ApiModelProperty(value="商品数量")
    private Integer goodsNum;

    @ApiModelProperty(value="收件人")
    private String shipname;

    @ApiModelProperty(value="收货地址")
    private String address;

    @ApiModelProperty(value="联系方式")
    private String shipphone;

    @ApiModelProperty(value="商品detai")
    private Detail detail;

    public static OrderRsp ToMyOrderRsp(Order order,Detail detail){
        OrderRsp rsp =new OrderRsp();
        rsp.setShipname(order.getShipname());
        rsp.setAddress(order.getAddress());
        rsp.setShipphone(order.getShipphone());
        rsp.setGoodsId(detail.getGoods_id());
        rsp.setGoodsPrice(detail.getGoods_price());
        rsp.setGoodsName(detail.getGoods_name());
        rsp.setGoodsPic(detail.getGoods_pic());
        rsp.setGoodsColor(detail.getGoods_color());
        rsp.setGoodsNum(detail.getGoods_num());
        rsp.setId(order.getId());
        return rsp;
    }

    public Long getId() {
        return Id;
    }

    public void setId(Long id) {
        Id = id;
    }

    public String getShipname() {
        return shipname;
    }

    public void setShipname(String shipname) {
        this.shipname = shipname;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getShipphone() {
        return shipphone;
    }

    public void setShipphone(String shipphone) {
        this.shipphone = shipphone;
    }

    public Detail getDetail() {
        return detail;
    }

    public void setDetail(Detail detail) {
        this.detail = detail;
    }

    public Long getGoodsId() {
        return goodsId;
    }

    public void setGoodsId(Long goodsId) {
        this.goodsId = goodsId;
    }

    public BigDecimal getGoodsPrice() {
        return goodsPrice;
    }

    public void setGoodsPrice(BigDecimal goodsPrice) {
        this.goodsPrice = goodsPrice;
    }

    public String getGoodsName() {
        return goodsName;
    }

    public void setGoodsName(String goodsName) {
        this.goodsName = goodsName;
    }

    public String getGoodsPic() {
        return goodsPic;
    }

    public void setGoodsPic(String goodsPic) {
        this.goodsPic = goodsPic;
    }

    public Integer getGoodsColor() {
        return goodsColor;
    }

    public void setGoodsColor(Integer goodsColor) {
        this.goodsColor = goodsColor;
    }

    public Goods getGoods() {
        return goods;
    }

    public void setGoods(Goods goods) {
        this.goods = goods;
    }

    public Integer getGoodsNum() {
        return goodsNum;
    }

    public void setGoodsNum(Integer goodsNum) {
        this.goodsNum = goodsNum;
    }

}
